# Maintainer: Adam Jensen <acjensen@gmail.com>
pkgname=libbpf
pkgver=0.8.0
pkgrel=0
pkgdesc="A library for interacting with the Linux kernel's Berkeley Packet Filter (BPF) facility from user space"
url="https://github.com/libbpf/libbpf"
arch="all"
license="GPL-2.0-only"
# No test suite
options="!check"
depends="elfutils"
makedepends="build-base linux-headers elfutils-dev zlib-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/libbpf/libbpf/archive/refs/tags/v$pkgver.tar.gz
	10-consolidate-lib-dirs.patch"

build() {
	cd src
	make NO_PKG_CONFIG=1
}

package() {
	cd src
	make install DESTDIR="$pkgdir"
	# install somewhere out of the way that will hopefully not be included by mistake
	mkdir -p "$pkgdir/usr/include/bpf/uapi/linux"
	for header in bpf.h bpf_common.h btf.h; do
		cp "$builddir/include/uapi/linux/$header" "$pkgdir/usr/include/bpf/uapi/linux/"
	done
}

sha512sums="
8b034a9c8f23207638630b95ff95a651148a800589eb52f2fe09698bf3c4147f2e2008b24de45a70832cc7669cdfebd78bc491e575ca0b27de5c2de3b1fb5637  libbpf-0.8.0.tar.gz
07719f3f1d955dc1b0058a5d47b1c755a985a74c17a2bfa40bcc9a781572d68d4282b5bab0d34e8a16961dba4de0f23550522369456d17e8632b8a978fa55351  10-consolidate-lib-dirs.patch
"
